<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>cilck事件</title>
    <script type="text/javascript" src="../../../public/vue.js">
    </script>
</head>
<body>
<div id="app">

    <div @click.prevent="click2">
        <button @click="click">点击prevent</button>
    </div>
    <div @click.passive="click2">
        <button @click="click">点击passive</button>
    </div>

    <div @click="click2">
        <button @click.stop="click">点击stop</button>
    </div>

    <div @click.self="click2">
        self
        <button @click="click">点击</button>
    </div>

    <div @click.self="click2">
        <button @click.once="click">点击once</button>
    </div>
    <div>
        输入：<input type="text" @keyup.enter="handleEnter" >
    </div>
</div>
</body>
<script type="text/javascript">
    Vue.config.productionTip=false

    new Vue({
        el:'#app',
        data:{

        },
        methods:{
            click(){
                alert('点击了1')
            },
            click2(){
                alert('点击了2')
            },
            handleEnter(event) {
                console.log(event.target.value);
                // 在这里处理回车键被按下的逻辑
            }
        }
    })

</script>
</html>